/*
 * Copyright (c) 2023 豪雅集团 Authors. All Rights Reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package Others.Canal.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.HashSet;
import java.util.Set;

/**
 * @Description Canal配置属性类
 * @Author : lzw
 * @Copyright Copyright (c) 豪雅集团
 * @Create 2025/09
 * @Version 1.0.0
 */
@Data
@ConfigurationProperties(prefix = "canal")
public class CanalProperties {
    
    /**
     * 是否启用Canal
     */
    private boolean enabled = true;
    
    /**
     * Canal服务器IP
     */
    private String serverIp;
    
    /**
     * Canal服务器端口
     */
    private int serverPort;
    
    /**
     * 目标实例
     */
    private String destination;
    
    /**
     * 用户名
     */
    private String username;
    
    /**
     * 密码
     */
    private String password;
    
    /**
     * 订阅规则--对于canal文件本身可以粗粒度，而客户端可以细粒度，比如： hooya_config\..*
	 * 意味着订阅hooya_config数据库的所有表
     */
    private String subscribe;
    
    /**
     * 初始延迟时间(毫秒)
     */
    private String initialDelay = "3000";
    
    /**
     * 固定延迟时间(毫秒)
     */
    private String fixedDelay = "3000";
    
    /**
     * 最大重试次数
     */
    private int maxRetries = 5;
    
    /**
     * 重试间隔时间(毫秒)
     */
    private int retryInterval = 5000;

	/**
	 * 监控的数据库名
	 * 必填项，否则空指针
	 */
	private String dbName;

	/**
	 * 监控的表名
	 * 为必填项，否则空指针
	 */
	private Set<String> tableSet = new HashSet<>();

}